package com.bw.day2task;

import android.os.Bundle;
import android.widget.ImageView;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.StaggeredGridLayoutManager;

import com.bumptech.glide.Glide;
import com.bw.day2task.bean.BeanVideo;
import com.bw.day2task.mvp.content.LogContent;
import com.bw.library.mvp.view.BaseActivity;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import org.jetbrains.annotations.NotNull;

import java.util.List;

public abstract class MainActivity extends BaseActivity implements LogContent.View {

    private RecyclerView mrecyclerView;

    @Override
    public int bandLayout() {
        return R.layout.activity_main;
    }

    @Override
    public void initData() {
        //mrecyclerView.setLayoutManager(new StaggeredGridLayoutManager(1,StaggeredGridLayoutManager.VERTICAL));
    }

    @Override
    public void initView() {
//        mrecyclerView/
    }
    @Override
    public void getvideo(BeanVideo beanVideo) {
        List<BeanVideo.ResultBean> result = beanVideo.getResult();
        MyAdapter myAdapter = new MyAdapter(result);
        //mrecyclerView.setAdapter(myAdapter);
    }
    //适配器1
    public class MyAdapter extends BaseQuickAdapter<BeanVideo.ResultBean, BaseViewHolder> {

        public MyAdapter(@Nullable List<BeanVideo.ResultBean> data) {
            super(R.layout.item, data);
        }

        @Override
        protected void convert(@NotNull BaseViewHolder baseViewHolder, BeanVideo.ResultBean dataBean) {
            Glide.with(getContext()).load(dataBean.getCoverImg()).into((ImageView) baseViewHolder.getView(R.id.item_img));
            baseViewHolder.setText(R.id.item_id, dataBean.getUserId());
        }
    }
}